//--------------------------------------------------------------------
//
//  Laboratory 4                                          listarr2.h
//
//  Class declaration for the array implementation of the List ADT
//  (Laboratory 3) with modifications to support inheritance by the
//  array implementation of the Ordered List ADT
//
//--------------------------------------------------------------------

#ifndef LISTARR2_H
#define LISTARR2_H

#include <stdexcept>

using namespace std;

const int defMaxListSize = 100;   // Default maximum list size

template < class DT >
class aList
{
  public:

    // Constructor
    aList ( int maxNumber = defMaxListSize );

    // Destructor
    ~aList ();

    // List manipulation operations
    virtual void insert ( const DT &newDataItem );       // Insert
        //throw ( logic_error );    
    void remove ();                                      // Remove
        //throw ( logic_error );
    virtual void replace ( const DT &newDataItem );      // Replace
        //throw ( logic_error );
    void clear ();                                       // Clear list

    // List status operations
    bool isEmpty () const;                    // List is empty
    bool isFull () const;                     // List is full

    // List iteration operations
    void gotoBeginning ();                    // Go to beginning
        //throw ( logic_error );
    void gotoEnd ();                          // Go to end
        //throw ( logic_error );
    bool gotoNext ();                         // Go to next element
        //throw ( logic_error );
    bool gotoPrior ();                        // Go to prior element
        //throw ( logic_error );
    DT getCursor () const;                    // Return element
        //throw ( logic_error );

    // Output the list structure -- used in testing/debugging
//    void showStructure () const;

    // In-lab operations (Laboratory 4)
    void moveToNth ( int n );                     // Move element to pos. n
        //throw ( logic_error );
    //bool find ( const DataType &searchElement );  // Find element
        //throw ( logic_error );

  protected:

    // Data members
    int maxSize,    // Maximum number of elements in the list
        size,       // Actual number of elements in the list
        cursor;     // Cursor array index
    DT *dataItems;  // Array containing the list elements
};

#endif // #ifndef LISTARR2_H

